package gold.digger;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC1446 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int maxPower(String s) {
            char last = '1';
            int maxRepeat = 0, curRepeat = 0;
            for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i) == last) ++curRepeat;
                else {
                    maxRepeat = Math.max(maxRepeat, curRepeat);
                    last = s.charAt(i);
                    curRepeat = 1;
                }
            }

            return Math.max(maxRepeat, curRepeat);
        }
    }

    public void run() {
        Solution solution = new Solution();
        System.out.println(solution.maxPower("abbcccddddeeeeeeebca"));
    }

    public static void main(String[] args) throws Exception {
        LC1446 an = new LC1446();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
